package com.qiaofang.applet.service.property.service.mapstruct;

import com.qiaofang.applet.constants.PropertyImageConstants;
import com.qiaofang.applet.service.property.domain.PropertyVideo;
import com.qiaofang.applet.service.property.service.dto.PropertyImageDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;

@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface PropertyVideoMapper {

    default PropertyImageDto domainToImageDto(PropertyVideo propertyVideo) {
        if (propertyVideo == null) {
            return null;
        }

        PropertyImageDto imageDto = new PropertyImageDto();
        imageDto.setImageType(PropertyImageConstants.VIEDO_TYPE.getValue());
        imageDto.setImgUrl(propertyVideo.getCoverPhotoUrl());
        imageDto.setLinkUrl(propertyVideo.getVideoUrl());

        return imageDto;
    }

}
